package com.xucan.mapperstruct;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface UserMapper {

    // 固定写法
    UserMapper INSTANCE = Mappers.getMapper(UserMapper.class);


    @Mapping(source = "date", target = "localDate")
    @Mapping(source = "name", target = "username")
    UserDTO userToUserDTO(User user);
}
